package 拼多多;

import java.util.Scanner;

public class PDD3 {
    private static int ans = 0;
    private static int n = 0;
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt(), M = scan.nextInt(), count = 0;
        int[] arr = new int[N];
        int[][] dp = new int[N][N];
        for (int i = 0; i < N; i++) {
            int num = scan.nextInt();
            arr[i] = num % M;
        }
        for (int i = 0; i < N; i++) {
            dp[i][i] = arr[i];
            for(int j = i+1 ; j < N ; j++){
                dp[i][j] = (dp[i][j-1] + arr[j])%M;
            }
        }
        for (int i = 0; i < N; i++) {
            for (int j = i ; j < N; j++) {
                if (dp[i][j] == 0) {
                    count++;
                }
            }
        }
        System.out.println(count);
    }
}
